import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

const Index = r => require(['../views/index/index.vue'], r);
const Home = r => require(['../views/home/home.vue'], r);
const BlogClassify = r => require(['../views/blogClassify/blogClassify.vue'], r);
const Detail = r => require(['../views/detail/detail.vue'], r);
const About = r => require(['../views/about/about.vue'], r);
// const Home = () => import('../views/home/home.vue');
// const BlogClassify = () => import('../views/blogClassify/blogClassify.vue');
// const Detail = () => import('../views/detail/detail.vue');
// const About = () => import('../views/about/about.vue');


const routes = [
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '/index',
    name: 'index',
    redirect: '/home',
    component: Index,
    children: [
      {
        path: '/home',
        name: 'home',
        component: Home
      },
      {
        path: '/blogClassify/:classify',
        name: 'blogClassify',
        component: BlogClassify
      },
      {
        path: '/detail',
        name: 'detail',
        component: Detail
      },
      {
        path: '/about',
        name: 'about',
        component: About
      },
    ]
  },
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
});

export default router
